// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
	
	// 参数配置对象
	const config = vm.vuex_config;
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		//校验token是否有效
		check: (params = {}) => vm.$u.get(config.apiPath + '/login/check', params),
		//登陆注册短信验证码
		loginSmsCode: (params = {}) => vm.$u.post('login/smsCode', params),
		//忘记密码短信验证码
		forgetSmsCode: (params = {}) => vm.$u.post('forget/smsCode', params),
		//换绑手机号短信验证码
		changetieSmsCode: (params = {}) => vm.$u.post('changetie/smsCode', params),
		//更改密码
		forgetPwd: (params = {}) => vm.$u.post(config.apiPath +'/user/forget', params),
		//手机号登陆
		mobileLogin: (params = {}) => vm.$u.post('mobile/login', params),
		//短信验证码登陆
		smsCodeLogin: (params = {}) => vm.$u.post('sms/login', params),
		//退出登陆
		logout: (params = {}) => vm.$u.get('logout', params),
		//获取配置
		getConfig: (params = {}) => vm.$u.post(config.apiPath + '/config/get_config', params),
		//注册
		register: (params = {}) => vm.$u.post(config.apiPath + '/user/register', params),
		//超级分类
		childClassify: (params = {}) => vm.$u.post(config.apiPath + '/classify/child', params),
		//banner
		banners: (params = {}) => vm.$u.post(config.apiPath  + '/banner/list', params),
		//导航栏
		navigates:(params = {}) => vm.$u.post(config.apiPath  + '/navigate/list', params),
		//最新公告
		bulletins:(params = {}) => vm.$u.post(config.apiPath  + '/bulletin/list', params),
		//精选好物12条数据
		deserves:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_deserve_item', params),
		//好物推荐
		saless:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_sales_list', params),
		//商品筛选
		goods:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_good_filter', params),
		//超级分类
		superClassifys:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_super_classify', params),
		//精编文案
		excellentEditors:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_excellent_editor', params),
		//朋友圈商品
		selectedItems:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_selected_item', params),
		//淘宝商品详情
		tbItemDetail:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_item_detail', params),
		//京东商品详情
		jdItemDetail:(params = {}) => vm.$u.post(config.apiPath  + '/good/dtk_jd_goods_info', params),
		//拼多多商品详情
		pddItemDetail:(params = {}) => vm.$u.post(config.apiPath  + '/pdd/goods_info', params),
		//猜你喜欢
		similarInfo:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_similar_info', params),
		//热门搜索
		hotKeys:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_hot_key', params),
		//联想词
		suggestions:(params = {}) => vm.$u.post(config.apiPath  + '/good/get_search_suggestion', params),
		//京东商品搜索
		jdGoodSearch:(params = {}) => vm.$u.post(config.apiPath  + '/good/dtk_jd_goods_search', params),
		//拼多多商品搜索
		pddGoodSearch:(params = {}) => vm.$u.post(config.apiPath  + '/good/dtk_pdd_goods_search', params),
		//淘宝商品搜索
		tbGoodSearch:(params = {}) => vm.$u.post(config.apiPath  + '/good/dtk_goods_search', params),
		
		//淘宝商品转链
		tbPrivilegeLink:(params = {}) => vm.$u.post(config.apiPath  + '/good/tb_privilege_link', params),
		//京东商品转链
		jdPrivilegeLink:(params = {}) => vm.$u.post(config.apiPath  + '/good/jd_privilege_link', params),
		//拼多多商品转链
		pddPrivilegeLink:(params = {}) => vm.$u.post(config.apiPath  + '/good/pdd_privilege_link', params),
		//获取抽奖配置
		lotteryConfig:(params = {}) => vm.$u.post(config.apiPath  + '/lottery/config', params),
		//获取抽奖奖品列表
		lotteryList:(params = {}) => vm.$u.post(config.apiPath  + '/lottery/list', params),
		//获取抽中奖下标
		lotteryIndex:(params = {}) => vm.$u.post(config.apiPath  + '/lottery/index', params),
		//反馈内容
		feedback:(params = {}) => vm.$u.post(config.apiPath  + '/feedback/submit', params),
		//获取消息
		msgLists:(params = {}) => vm.$u.post(config.apiPath  + '/common/msgList', params),
		//用户相关
		user: {
			//我的足迹
			footprints: (params = {}) => vm.$u.post(config.apiPath+'/footprint/list', params),
			//保存足迹
			footprintInsert: (params = {}) => vm.$u.post(config.apiPath+'/footprint/insert', params),
			//我的收藏
			collects: (params = {}) => vm.$u.post(config.apiPath+'/collect/list', params),
			//保存收藏
			collectInsert:(params = {}) => vm.$u.post(config.apiPath+'/collect/insert', params),
			//是否收藏
			collectInfo:(params = {}) => vm.$u.post(config.apiPath+'/collect/exist', params),
			//更新用户昵称 
			updateNickName: (params = {}) => vm.$u.post(config.apiPath+'/user/update_nick_name', params),
			//换绑手机号
			changeTieMobile: (params = {}) => vm.$u.post(config.apiPath+'/user/change_tie_mobile', params),
			//用户签到
			signIn: (params = {}) => vm.$u.post(config.apiPath+'/sign/in', params),
			//签到历史
			signHistory: (params = {}) => vm.$u.post(config.apiPath+'/sign/history', params),
		},
	};
	
}

export default {
	install
}